﻿#region Legal notice
/*
 * This file is part of EPPLib.
 * Copyright 2010, 2011 
 * Gianluca Esposito (info@gianlucaesposito.it)
 * ----------------------------------------------------------------------------
 * EPPLib is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or
 * (at your option) any later version.
 * 
 * EPPLib is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with Nome-Programma; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc;
using System.ComponentModel.DataAnnotations;

namespace EPPLib.Data
{
    public class ContactDataObject : BaseDataObject
    {
        #region Members
        private int _internalID;
        private Guid _ownerID;
        private string _id;
        private string _name;
        private string _organization;
        private string _street1;
        private string _street2;
        private string _street3;
        private string _city;
        private string _district;
        private string _postalCode;
        private string _countryCode;
        private string _phonePrefix;
        private string _phone;
        private string _phoneInternal;
        private string _faxPrefix;
        private string _fax;
        private string _faxInternal;
        private string _email;
        private string _authInfo;
        private bool _consentForPublishing;
        private string _nationalityCode;
        private int _entityType;
        private string _entityTypeDescription;
        private string _regCode;

        private string _nicID;
        private string _currentRegistrar;
        private string _createRegistrar;
        private string _updateRegistrar;
        private string _status1;
        private string _status2;
        private DateTime? _createDate;
        private DateTime? _updateDate;
        #endregion

        #region Properties
        public int InternalID { get { return _internalID; } set { _internalID = value; } }

        public Guid OwnerID { get { return _ownerID; } set { _ownerID = value; } }

        [StringLength(16, ErrorMessage = "Valore oltre la lunghezza massima")]
        public string ID { get { return _id; } set { _id = value; } }

        [StringLength(255, ErrorMessage = "Valore oltre la lunghezza massima")]
        public string Name { get { return _name; } set { _name = value; } }

        [StringLength(255, ErrorMessage = "Valore oltre la lunghezza massima")]
        public string Organization { get { return _organization; } set { _organization = value; } }

        [StringLength(128, ErrorMessage = "Valore oltre la lunghezza massima")]
        public string Street1 { get { return _street1; } set { _street1 = value; } }

        [StringLength(128, ErrorMessage = "Valore oltre la lunghezza massima")]
        public string Street2 { get { return _street2; } set { _street2 = value; } }

        [StringLength(128, ErrorMessage = "Valore oltre la lunghezza massima")]
        public string Street3 { get { return _street3; } set { _street3 = value; } }

        [StringLength(128, ErrorMessage = "Valore oltre la lunghezza massima")]
        public string City { get { return _city; } set { _city = value; } }

        [StringLength(128, ErrorMessage = "Valore oltre la lunghezza massima")]
        public string District { get { return _district; } set { _district = value; } }

        [RegularExpression(@"^\d*$", ErrorMessage = "Presenti caratteri non ammessi")]
        [StringLength(16, ErrorMessage = "Valore oltre la lunghezza massima")]
        public string PostalCode { get { return _postalCode; } set { _postalCode = value; } }

        [RegularExpression(@"^[a-zA-Z]*$", ErrorMessage = "Presenti caratteri non ammessi")]
        [StringLength(2, ErrorMessage = "Valore oltre la lunghezza massima")]
        public string CountryCode { get { return _countryCode; } set { _countryCode = value; } }

        [StringLength(16, ErrorMessage = "Valore oltre la lunghezza massima")]
        public string PhonePrefix { get { return _phonePrefix; } set { _phonePrefix = value; } }

        [RegularExpression(@"^\d*$", ErrorMessage = "Presenti caratteri non ammessi")]
        [StringLength(16, ErrorMessage = "Valore oltre la lunghezza massima")]
        public string Phone { get { return _phone; } set { _phone = value; } }

        [RegularExpression(@"^\d*$", ErrorMessage = "Presenti caratteri non ammessi")]
        [StringLength(16, ErrorMessage = "Valore oltre la lunghezza massima")]
        public string PhoneInternal { get { return _phoneInternal; } set { _phoneInternal = value; } }

        [StringLength(16, ErrorMessage = "Valore oltre la lunghezza massima")]
        public string FaxPrefix { get { return _faxPrefix; } set { _faxPrefix = value; } }

        [RegularExpression(@"^\d*$", ErrorMessage = "Presenti caratteri non ammessi")]
        [StringLength(16, ErrorMessage = "Valore oltre la lunghezza massima")]
        public string Fax { get { return _fax; } set { _fax = value; } }

        [RegularExpression(@"^\d*$", ErrorMessage = "Presenti caratteri non ammessi")]
        [StringLength(16, ErrorMessage = "Valore oltre la lunghezza massima")]
        public string FaxInternal { get { return _faxInternal; } set { _faxInternal = value; } }

        [RegularExpression(@"^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$", ErrorMessage = "Indirizzo email non valido")]
        [StringLength(64, ErrorMessage = "Valore oltre la lunghezza massima")]
        public string Email { get { return _email; } set { _email = value; } }

        [StringLength(255, ErrorMessage = "Valore oltre la lunghezza massima")]
        public string AuthInfo { get { return _authInfo; } set { _authInfo = value; } }

        public bool ConsentForPublishing { get { return _consentForPublishing; } set { _consentForPublishing = value; } }

        [RegularExpression(@"^[a-zA-Z]*$", ErrorMessage = "Presenti caratteri non ammessi")]
        [StringLength(2, ErrorMessage = "Valore oltre la lunghezza massima")]
        public string NationalityCode { get { return _nationalityCode; } set { _nationalityCode = value; } }

        public int EntityType { get { return _entityType; } set { _entityType = value; } }

        public string EntityTypeDescription { get { return _entityTypeDescription; } set { _entityTypeDescription = value; } }

        [StringLength(36, ErrorMessage = "Valore oltre la lunghezza massima")]
        public string RegCode { get { return _regCode; } set { _regCode = value; } }

        public string NicID { get { return _nicID; } set { _nicID = value; } }
        public string Status1 { get { return _status1; } set { _status1 = value; } }
        public string Status2 { get { return _status2; } set { _status2 = value; } }
        public string CurrentRegistrar { get { return _currentRegistrar; } set { _currentRegistrar = value; } }
        public string CreateRegistrar { get { return _createRegistrar; } set { _createRegistrar = value; } }
        public string UpdateRegistrar { get { return _updateRegistrar; } set { _updateRegistrar = value; } }
        public DateTime? CreateDate { get { return _createDate; } set { _createDate = value; } }
        public DateTime? UpdateDate { get { return _updateDate; } set { _updateDate = value; } }
        #endregion

        #region Constructor(s)
        public ContactDataObject()
        {
            _ownerID = Guid.Empty;
            _internalID = 0;
            _id = string.Empty;
            _name = string.Empty;
            _organization = string.Empty;
            _street1 = string.Empty;
            _street2 = string.Empty;
            _street3 = string.Empty;
            _city = string.Empty;
            _district = string.Empty;
            _postalCode = string.Empty;
            _countryCode = string.Empty;
            _phonePrefix = string.Empty;
            _phone = string.Empty;
            _phoneInternal = string.Empty;
            _faxPrefix = string.Empty;
            _fax = string.Empty;
            _faxInternal = string.Empty;
            _email = string.Empty;
            _authInfo = string.Empty;
            _consentForPublishing = false;
            _nationalityCode = string.Empty;
            _entityType = 0;
            _entityTypeDescription = string.Empty;
            _regCode = string.Empty;

            _nicID = string.Empty;
            _currentRegistrar = string.Empty;
            _createRegistrar = string.Empty;
            _updateRegistrar = string.Empty;
            _status1 = string.Empty;
            _status2 = string.Empty;
            _createDate = null;
            _updateDate = null;
        }
        #endregion
    }
}
